/*package com.kl.test;

import java.io.File;
import java.io.IOException;

import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;

import org.w3c.dom.Attr;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.xml.sax.SAXException;

public class MyXMLReader {
	public static void main(String[] args) {
		Element element = null;
		  // 可以使用绝对路劲
		 try{
			   
			  File xmlFile = new File("C:\\Users\\WYN\\Desktop\\kl.xml");
			   
			  DocumentBuilderFactory builderFactory = DocumentBuilderFactory.newInstance();
			   
			  DocumentBuilder builder = builderFactory.newDocumentBuilder();
			   
			  Document doc = builder.parse(xmlFile);
			   
			  doc.getDocumentElement().normalize();
			   
			  System.out.println("Root element: "+doc.getDocumentElement().getNodeName());
			   
			  NodeList nList = doc.getElementsByTagName("book");
			   
			  for(int i = 0 ; i<nList.getLength();i++){
			   
			  Node node = nList.item(i);
			   
			  System.out.println("Node name: "+ node.getNodeName());
			  Element ele = (Element)node;
			   
			  System.out.println("----------------------------");
			  if(node.getNodeType() == Element.ELEMENT_NODE){
			   
			  System.out.println("book category: "+ ele.getAttribute("category"));
			   
			  System.out.println("title name: "+ ele.getElementsByTagName("title").item(0).getTextContent());
			   
			  System.out.println("author name: "+ele.getElementsByTagName("author").item(0).getTextContent());
			   
			  System.out.println("year :"+ele.getElementsByTagName("year").item(0).getTextContent());
			   
			  System.out.println("price : "+ele.getElementsByTagName("price").item(0).getTextContent());
			   
			  System.out.println("-------------------------");
			   
			  }
			  }
			  } catch(Exception e){
				  e.getMessage();
			  }
			 
	}
}
*/